package com.reserv.servlet;

import java.io.IOException;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.reserv.dao.CommentDAO;
import com.reserv.vo.CommentVO;


public class CommentServlet extends HttpServlet {
	private CommentDAO dao;
	@Override
	public void init(ServletConfig config) throws ServletException {
		dao = CommentDAO.getInstance();
		
	}
	private void doProcess(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		int fno = Integer.parseInt(request.getParameter("fno"));
		String uid = request.getParameter("uid");
		int grade = Integer.parseInt(request.getParameter("grade"));
		String comment = request.getParameter("comment");
		
		CommentVO c = new CommentVO();
		c.setFno(fno);
		c.setUid(uid);
		c.setGrade(grade);
		c.setComment(comment);
		
		dao.createVO(c);
	}
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doProcess(request, response);
	}
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doProcess(request, response);
	}
}
